package com.zbcz.crm.bean

import android.os.Parcel
import android.os.Parcelable

data class Customer(
    var createBy: String? = "",  // 创建者
    var createTime: String? = "",  // 创建时间（格式：yyyy-MM-dd HH:mm:ss）
    var customerDetailedAddress: String? = "",  // 客户详细地址
    var customerIndustry: String? = "",  // 客户行业 (0IT 1金融业 2房地产 3商业服务 4运输/物流 5生产 6政府 7文化传媒)
    var customerLevel: String? = "",  // 客户级别 (A（重点客户）B（普通客户） C（非优先客户）)
    var customerName: String? = "",  // 客户名称
    var customerPhone: String? = "",  // 客户手机
    var customerPhoneNumber: String? = "",  // 客户电话
    var customerSource: String? = "",  // 客户来源 (0促销 1搜索引擎 2广告 3转介绍 4线上注册 5线上询价 6预约上门 7陌拜8电话咨询 9邮件咨询)
    var customerWebsite: String? = "",  // 客户网址
    var dealStatus: String? = "",  // 成交状态 (0已成交 1未成交)
    var id: String? = "",  // ID
    var notes: String? = "",  // 备注
    var sysOrgCode: String? = "",  // 组织代码
    var updateBy: String? = "",  // 更新者
    var updateTime: String? = ""  // 更新时间（格式：yyyy-MM-dd HH:mm:ss）
) : Parcelable {
    var isChecked = false

    constructor(parcel: Parcel) : this(
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString()
    ) {
        isChecked = parcel.readByte() != 0.toByte()
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(createBy)
        parcel.writeString(createTime)
        parcel.writeString(customerDetailedAddress)
        parcel.writeString(customerIndustry)
        parcel.writeString(customerLevel)
        parcel.writeString(customerName)
        parcel.writeString(customerPhone)
        parcel.writeString(customerPhoneNumber)
        parcel.writeString(customerSource)
        parcel.writeString(customerWebsite)
        parcel.writeString(dealStatus)
        parcel.writeString(id)
        parcel.writeString(notes)
        parcel.writeString(sysOrgCode)
        parcel.writeString(updateBy)
        parcel.writeString(updateTime)
        parcel.writeByte(if (isChecked) 1 else 0)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<Customer> {
        override fun createFromParcel(parcel: Parcel): Customer {
            return Customer(parcel)
        }

        override fun newArray(size: Int): Array<Customer?> {
            return arrayOfNulls(size)
        }
    }
}

